<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<div>
<form id="categoryform">
<!--<div class="inputLabel">
<label class="left">选择父类目:</label>
	<select id="productCategory" name="parentPcId"></select>
</div>
-->
<!--<input type="hidden" name="parentPcId" value="root" />
--><div class="inputLabel">
<label class="left">选择父级:</label>
<s:select name="pc.id"  list="pcMap" headerKey="root" headerValue="顶级"/>
</div>
<div class="inputLabel">
<label class="left">是否独立类目:</label>
<s:select name="pc.isIndependent"  list="#{0:'否',1:'是'}"/>
</div>
<div class="inputLabel">
<label class="left">类目名称:</label>
<input type="text" class="text" id="nameCn" name="pc.nameCn" />
</div>
</form>
</div>
<script type="text/javascript">
$(function(){
	loadCategory();
});

function loadCategory(){
	var nodeHead = "<option value='root'>根目录</option>";
	$("#productCategory").append(nodeHead);
	$.ajax({
		url:'loadProductCategory.action',
		type: 'post',
		cache: false,
		dataType: 'json',
		success: function(data){
			data = eval(data);
			$.each(data, function(index, item){
		       var node = "<option value='";
			   node += item.id;
			   node += "'>";
			   for(i=0;i<item.levels-1;i++){
			   		node += '&nbsp;&nbsp;';
			   }
			   node += item.nameEn;
			   node += "</option>";
			   $("#productCategory").append(node);
		    });
		}
	});
}
</script>